<html>
<head>
    <script src="/js/validate.js" type="text/javascript"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body style="background-color: transparent">
<form id="id-form" name="frm" method="post" action="/district/danhmucquanhuyen/save">
	<div id="toolbar-button">
			<div class="item" onclick="save()" name="SAVE" id="itemButton2" title="Lưu">
				<div id="save-global-button"></div>
			</div>
			<div class="item" onclick="back()" id="itemButton3" title="Trở lại">
				<div id="back-global-button"></div>				
			</div>
	</div>	
	<input type=hidden name="id" value="<?=$this->data['DISTRICTID'] ?>" />
    <input type=hidden name="flag" value="<?=$this->flag ?>" />
 
        <table valign="center">
        <?php $id = $this->data['DISTRICTID']; ?>
        <tr>
            <td nowrap="nowrap">Tên quận huyện<font color="red">*</font></td>
            <td><input class="inp-form" id="idName" name ="name" value="<?=$this->data['NAME'];?>"type ="text" size ="30" maxlength="50">
                <span style="color: red" id="errtname"></span>
            </td>
			<tr>
            <td width="10%" nowrap="nowrap">Tỉnh thành <font color="red">*</font>
            </td>
            <td >
                <select style="width: 200px; height:30px" id="iCity" name="cityid" value="">
					<option value="">-- Chọn tỉnh thành --</option>
					<?php 
						foreach($this->listTinhThanh as $item){
								echo '<option  value="'.$item['CITYID'].'" ';
								if($item['CITYID'] == $this->data['CITYID'])
									echo 'selected';
								else 
									echo '';
								echo '><b>'.$item['NAME'].'</b></option>';
						}
					?>
				</select>  
            </td>
        </tr>
            <script>
                document.frm.name.focus();
            </script>
        </tr>        
    </table>
</form>
<Script language="JavaScript">
    function  save(){
    	var vlidName= document.getElementById('idName');
    	if(vlidName.value==""){
    		alert('Tên quận huyện không được rỗng');
    		flag=1;
    		return;
    	}
    	else{
			flag=0;
        	}
		
		// var vlidCity= document.getElementById('iCity');			
		// if(vlidCity.value=="" || vlidCity.value=="-- Chọn tỉnh thành --"){
    		// alert('Hãy chọn tỉnh thành!');
    		// flag=1;
    		// return;
    	// }
    	// else{
			// flag=0;
        	// }
			
    	if(flag==0){
    		document.frm.submit();
    	}else{
        	document.location.href='/district/danhmucquanhuyen/input';
        	}
    }

    function back(){
        document.location.href='/district/danhmucquanhuyen/index';
    }
</Script>
</body>
</html>
